// 全局样式：还原 ER 图编辑区的视觉
.dbml-graph-wrapper {
  background-color: #fff;
  color: #0f172a;
  font-family: "HarmonyOS_Sans_SC", "HarmonyOS_Sans", "-apple-system", BlinkMacSystemFont,
    "PingFang SC", "Microsoft YaHei", Arial, "Helvetica Neue", Helvetica, "Roboto", sans-serif;
}

.db-table__background,
.db-table__highlight .db-table__background,
.db-table__dragging .db-table__background,
.db-table:hover .db-table__background {
  rx: 24 !important;
  ry: 24 !important;
  stroke-linejoin: round !important;
  shape-rendering: geometricPrecision !important;
}

.db-chart {
  shape-rendering: geometricPrecision;
  cursor: grab;
}

.db-chart:active {
  cursor: grabbing;
}

.db-chart__bg {
  fill: #fff;
}

.db-chart__bg-grid path,
.db-chart__bg-grid-small path {
  stroke: rgba(15, 23, 42, 0.08);
  stroke-width: 1;
}

.db-chart__bg-grid-small path {
  stroke-width: 0.5;
  opacity: 0.6;
}

.db-table__background {
  fill: #ffffff;
  stroke: #dbe3ef;
  stroke-width: 1.5;
  rx: 24;
  ry: 24;
  filter: drop-shadow(0 12px 24px rgba(15, 23, 42, 0.08));
  stroke-linejoin: round;
}

.db-table {
  cursor: grab;
}

.db-table__dragging {
  cursor: grabbing;
}

.db-table__highlight .db-table__background,
.db-table__dragging .db-table__background {
  stroke: #2563eb;
  stroke-width: 2;
}

.db-table-header rect {
  fill: #1f3a5f;
  rx: 14;
  ry: 14;
}

.db-table-header__name {
  fill: #f8fafc;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.2px;
  text-transform: uppercase;
  dominant-baseline: middle;
  alignment-baseline: middle;
  transform: translateY(4px);
}

.db-field rect {
  fill: #f8fafc;
  stroke: transparent;
  rx: 8;
  ry: 8;
}

.db-table__highlight .db-field rect,
.db-table__dragging .db-field rect {
  fill: rgba(47, 122, 242, 0.1);
}

.db-field__name,
.db-field__type,
.db-field__pk-icon,
.db-field__fk-icon {
  font-size: 12px;
  fill: #1f2937;
  alignment-baseline: middle;
  dominant-baseline: middle;
  text-anchor: start;
}

.db-field__type {
  fill: #64748b;
  font-weight: 500;
  text-anchor: end;
}

.db-field__pk-icon {
  fill: #fbbf24;
}

.db-field__fk-icon {
  fill: #38bdf8;
}

.db-field__nn-rect {
  fill: rgba(14, 165, 233, 0.12);
  stroke: rgba(14, 165, 233, 0.4);
  stroke-width: 1;
}

.db-field__nn-text {
  fill: #0284c7;
  font-size: 11px;
  font-weight: 600;
  dominant-baseline: middle;
  alignment-baseline: middle;
  text-anchor: middle;
}

.db-field__tooltip {
  padding: 8px 12px;
  background: rgba(15, 23, 42, 0.9);
  color: #f8fafc;
  border-radius: 6px;
  font-size: 12px;
  line-height: 1.4;
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.24);
}

.db-ref__path {
  fill: none;
  stroke: rgba(30, 64, 175, 0.55);
  stroke-width: 1.5;
  transition: stroke 0.15s ease, stroke-width 0.15s ease;
}

.db-ref__path-active {
  fill: none;
  stroke: rgba(59, 130, 246, 0.85);
  stroke-width: 2;
}

.db-ref__highlight .db-ref__path {
  stroke: rgba(59, 130, 246, 0.9);
  stroke-width: 2;
}

.db-ref__active .db-ref__path,
.db-ref__active .db-ref__path-active {
  stroke: rgba(37, 99, 235, 0.95);
  stroke-width: 2.5;
  stroke-dasharray: 8 6;
  animation: db-ref-flow 1.4s linear infinite;
}

.db-ref__hitbox {
  fill: none;
  stroke: transparent;
  stroke-width: 12;
}

.db-ref__endpoint {
  fill: #1f2937;
  stroke: #f8fafc;
  stroke-width: 2;
}

.db-ref__cardinality path {
  fill: none;
  stroke: #1f2937;
  stroke-linecap: round;
  stroke-width: 2;
}

.db-ref__label {
  fill: #475569;
  font-size: 11px;
  font-weight: 600;
  dominant-baseline: middle;
}

.db-tools,
#tools-layer {
  display: none;
}

.db-tooltip {
  pointer-events: none;
  overflow: visible;
}

.db-tooltip__content {
  overflow: visible;
}

.db-tooltip__content-card {
  background: rgba(15, 23, 42, 0.92);
  color: #f8fafc;
  border-radius: 8px;
  padding: 8px 12px;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.35);
  min-width: 160px;
}

.db-tooltip__content-card .q-card__section {
  padding: 4px 0;
}

.db-tooltip__content-card .q-separator {
  background: rgba(248, 250, 252, 0.16);
  margin: 6px 0;
}

.dbtt-title {
  display: flex;
  align-items: center;
  gap: 4px;
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 0.12em;
}

.dbtt-note {
  font-size: 12px;
  opacity: 0.9;
}

@keyframes db-ref-flow {
  from {
    stroke-dashoffset: 0;
  }
  to {
    stroke-dashoffset: -20;
  }
}
